<?php
/**
 * Created by PhpStorm.
 * User: Dave
 * Date: 2018/4/3
 * Time: 16:59
 */

use Biz\service\ShopMall as sShopMall;
use Doraemon\tools\ActionLog;
use Biz\service\trade\UserAddress;

/**
 * @deprecated
 */
class RecommendAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;

    public function main()
    {


        $page = $this->getRequest()->getQuery('page', 1);
        $page = $page < 1 ? 1 : $page;
        $provinceId = $this->getRequest()->getQuery('province_id'); // 预留
        $cityId = $this->getRequest()->getQuery('city_id');
        $areaCode = $cityId ? $cityId : $provinceId;
        $areaCode = $areaCode ? : UserAddress::getUserDefaultCityCode($this->uid);
        $result = sShopMall::getRecommendInfo($this->uid > 0 ? $this->uid : $this->vid, $page, $areaCode, $this->appVersion);
        ActionLog::log($this->uid, ['page' => $page], ActionLog::BIZ_GOODS_RECOMMEND);
        ActionLog::log($this->uid, [], ActionLog::BIZ_MALL_RECOMMEND);
        $result = $result ?: (object)$result;
        $this->setSuccess($result);

    }
}